<?php

namespace App\Http\Controllers\Api\V1;

use App\Http\Controllers\Controller;
use App\Models\Article;
use Illuminate\Http\Request;
use OSS\Core\OssException;
use OSS\OssClient;

class ArticleController extends BaseController
{
    /*
     * 文章列表展示
     */
    public function getNewList(Request $request){


        $data=Article::paginate(6);

        return $this->writeJson(0,$data,"success");


    }

    /*
     * 获取接口内容详情 ，点击量自增
     */
    //如果是 数字 ，自动获取对象中 对应的数据
    public function getNewsDetail(Article $news){

        $news->clicks=$news->clicks+1;
        $news->save();
        return $this->writeJson(0,$news,"ok");

    }
}
